All Questions
18 questions
4votes
4answers
1kviews
Quick Sort Done Lucidly
I've been away from Programming and the Tech Industry for sometime. I thought I'd look at and try some of the older basic stuff. I bushed up to QuickSort and found most existing implementations of it, ...
2votes
1answer
357views
Sorting visualizer using Java Swing
I programmed a little sorting visualizer a while back and I have been meaning to get some feedback on the overall implementation and on what I could do better to have cleaner code or a "best ...
0votes
1answer
60views
Quicksort Invariant and steps to determine correcteness
I am having trouble with applying to 3 steps needed to proof correctness, most likely because I did not formally study CS or Mathematics and am still learning about loop and class invariants. The ...
6votes
3answers
179views
Class for managing a list of scores (game development)
For my game that I'm writing, I need, among other things, a data structure for storing best values. For this purpose, I tried to write a class that meets the most general needs, and yet does not seem ...
3votes
1answer
801views
Sorting an array of numbers in Java with an algorithm
This is pretty much one of my first programs that I have created in Java and I just wanted to ask if anyone sees some obvious errors or mistakes I made. The purpose of this program is to sort numbers ...
6votes
5answers
3kviews
Sort an array of 0s, 1s and 2s in Java
Write a program to sort an array of 0's,1's and 2's in ascending order. Input: The first line contains an integer 'T' denoting the total number of test cases. In each test cases, First ...
3votes
3answers
9kviews
Sorting integers in descending order
So, I coded a program which asks you the number of integers and the integers the user wants to sort in descending order. The program works but I feel like it is very inefficient. If I were to receive ...
0votes
1answer
571views
Sort a stack using Java
This is my attempted solution to cracking the coding interview exercise 3.5. Looking for any feedback on coding style or the algorithm anywhere I can improve really. The problem specification is as ...
2votes
2answers
685views
Class name search algorithm
Here is a test task from a company, where I'd like to work eventually. I solved all they wanted to me to do, however failed to get an interview. I do not know what is wrong with my solution, because ...
7votes
2answers
385views
Selection Sort algorithm in Java
I'm relatively young in Java, and am familiar with only the basics of the language, yet. I've started studying data structures, and I've made an attempt to create a solution for the selection sort ...
4votes
5answers
356views
Sorting ArrayList
Here is the task: Create several classes of flowers that extend abstract flower. all fields -- random. make a bunch of 20 different flowers calculate the price of the bunch sort bunch ...
1vote
2answers
119views
Possible sub-optimal selection sort
Why is this code "bad"? In all of the selection sort codes I am learning from, they do it much differently. I will learn the proper code from the book, but I would love to know why this particular ...
6votes
2answers
1kviews
Merge Sorting Lists
I'm fairly new to Java, arriving in the "future" from C and returning to type safety from Python. I'm looking for your suggestions to improve this code in the following areas: Correctness - are there ...
12votes
4answers
43kviews
Merge Sort an integer array
I've implemented merge sort an integer array. Is it okay to use i,j,k as variable name for looping? Should I change them to more meaningful names? Overall, any further suggestions on this code? ...
2votes
1answer
1kviews
Insertion sorting an int array
I'd like to improve this Insertion sort code ...